#ifndef I2C_DEV_H
#define I2C_DEV_H

#include <QObject>

class i2c_dev : public QObject
{
    Q_OBJECT
private:
    int fd = -1;
    char *filename = nullptr;   //i2c设备文件路径
    unsigned char dev_addr;     //设备地址
    bool is_open_dev = false;   //成功打开i2c设备文件标志

public:
    explicit i2c_dev(QObject *parent = nullptr,char *filename = (char*)"/dev/i2c-0",unsigned char dev_addr = 0x48);
    virtual ~i2c_dev();

protected:
    virtual int i2c_write(unsigned char reg_addr,unsigned char *buf,unsigned char len);
    virtual int i2c_read(unsigned char reg_addr,unsigned char *buf,unsigned char len);

signals:

};

#endif // I2C_DEV_H
